package kaka.utils
{
	import flash.display.DisplayObject;
	
	import mx.core.IFlexDisplayObject;
	import mx.core.UIComponent;
	import mx.effects.Fade;
	import mx.effects.Zoom;
	import mx.events.EffectEvent;
	import mx.managers.PopUpManager;

	/**
	 * 弹出窗特效
	 **/
	public class PopupEffect
	{
		public function PopupEffect()
		{
		}
		public static function show(windows:IFlexDisplayObject,parent:DisplayObject,modal:Boolean=false, childList:String=null):void
		{
			var fade:Fade=new Fade;
			fade.alphaFrom=0.0;
			fade.alphaTo=1.0;
			fade.target=windows;
			fade.addEventListener(EffectEvent.EFFECT_START,function():void
			{
				PopUpManager.addPopUp(windows,parent,modal,childList);
				PopUpManager.centerPopUp(windows);
			});
			fade.duration=800;
			fade.play();
		}
		public static function hide(windows:IFlexDisplayObject):void
		{
			var fade:Fade=new Fade;
			fade.alphaFrom=1.0;
			fade.alphaTo=0.0;
			fade.target=windows;
			fade.addEventListener(EffectEvent.EFFECT_END, function()  
			{  
				PopUpManager.removePopUp(windows);
			});  
			fade.duration=500;
			fade.play();
		}
	}
}